IMPORT TUTORIAL

Introduction

The purpose of this short tutorial is to show you how to bring legacy Proteus VSM projects into a modern Proteus project. It is not intended as a functional tutorial on the use of Proteus during simulation or testing.

We will use an old (Proteus 7) PIC calculator design as our example but the steps in this tutorial would apply to any legacy Proteus VSM project.

Creating the VSM Studio Project

We need to bind the microcontroller on the schematic to our new firmware project. To do this, edit the processor part and then click on the Edit Firmware button on the resulting dialogue form.

The Edit Component dialogue for the processor part, with the Edit Firmware button at the right hand side

Since we have no current project or firmware we will get a blank VSM Studio tab and a new firmware project wizard will appear to help us set up our project.

The New Firmware Project dialogue, with the family and controller fields filled in from the schematic part

The processor family and processor variant will be auto-selected based on the micro-controller part on the schematic. We need to change the compiler field based on what we have installed and what was used to compile the program previously. In our case we used the MPLAB C8 compiler so we select that one.

See Also:

Compilers and Compiler Detection

Finally, the checkbox at the bottom of the wizard is used to create a skeleton template source file to help with getting started in writing firmware. This is very useful when starting a new project from scratch but since we are importing existing source code we don't need this and can de-select the option.

The quick start files checkbox at the foot of the New Firmware Project dialogue

After exiting the dialogue form you should now see a project with the processor name in the project tree area of VSM Studio; our next step is to import our source to this project.

The new firmware project named after the processor part in the VSM Studio project tree

Importing the Source Files

Right click on the project name and select the 'Add Files' command from the resulting context menu (or launch from the Project menu).

The Add Files command on the context menu of the project name in the project tree

This opens a standard Windows file dialogue form from which you can navigate and select your old source files.

The Import File dialogue with several legacy source and header files selected

Holding the CTRL key down while clicking on files in this dialogue lets you select more than one file for import.

Repeat as necessary until all your source files have been imported. When you are finished all of our existing work is inside Proteus. Double clicking on a source file will open it in the Editing Window if changes are required.

Project Settings

In order to successfully compile the project we need to have the same option set as was used previously. In the majority of cases this is simply the default option set which is automatically configured for you by VSM Studio. However, it is not uncommon to have additional include directories or other project specific options which will need to be manually added to the project settings.

You can launch project settings by right clicking in the project tree, from the Project menu, or from the Project Settings button on the Build toolbar in VSM Studio.

The Project Settings command on the menu in VSM Studio

The Embed Files checkbox on the Controller tab is worthy of further discussion.

The Controller tab of the Project Settings dialogue, with the Embed Files checkbox selected

When this option is selected all source files are stored inside the main Proteus PDSPRJ file. A temporary session directory is used for compilation and simulation. This has the advantage that the Proteus project is portable and self-contained. If you turn this checkbox off then all of the source files will be deposited in the same directory as the main Proteus file. It then becomes your responsibility to organise and maintain relative/absolute paths to various files in the project.

Switching to the Options tab of the dialogue (which is titled Project Options) then allows you to set options for the compiler, assembler, linker and lib tools in your chosen toolchain.

The Project Settings dialogue listing the tool chain options for the imported project

In our example, the default configuration is fine so no changes are required.

See Also :

Project Settings

Build Configurations

Compile and Run

The last thing we need to do is build the source code and run a simulation. You can compile the project at any time using the CTRL+F7 shortcut key or via the build project command on the Build menu.

The Build Project command on the Build menu in VSM Studio

During the compile process, messages from the tool chain will be displayed in the Output Window at the bottom of the VSM Studio IDE and a 'compiled successfully' message is displayed if no problems are encountered.

Compiler and linker output in the VSM Studio Output window, ending with a compiled successfully message

A successful compile in VSM Studio automatically sends the firmware to the microcontroller part on the schematic ready for simulation. In order to run our program on our schematic all we need to do is press the play button on the animation control panel.

The play button on the animation control panel

Debugging and testing is beyond the scope of this tutorial but is covered in brief in the new project tutorial and in full in the main Proteus VSM tutorial.